#!/usr/bin/ksh

project=$1

if [[ ! -f /sas/rcs/projects/$project/.meta/.retag ]]
then
	exit 0
fi

rm -f /sas/rcs/projects/$project/.meta/.retag

. /etc/MBNA_env/910-codemgr2.env


cm2cd $project

release=$(cm2 list releases | tail -1 | awk '{print $1}')

sub=$(print $release | 
	perl -ne 'chomp;
	if(/_/) {
		my @F=split(/_/,$_);
		$x=int($F[1]);
		printf("%s_%02d",$F[0],$x+1);
	} else {
		print "$_","_01";
	}')

/sas/rcs/utils/msyncp --tagifchanged --usetag $sub --config /sas/rcs/projects/$project/.meta/msyncp.xml --verbose >/var/opt/mbnatools/sysadmin/log/msyncp_$project.log 2>&1

exit $?
